<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1.0,
minimum-scale=1.0,maximum-scale=1.0,user-scalable=no,minimal-ui">
    <link rel="stylesheet" type="text/css" href="file:///android_asset/h5/css/write.css">
    <script>
        window.onload = function () {
           let editor =  document.getElementById('editor');
           editor.setAttribute("contenteditable", "true");
        }

        function queryWriteData(){
            let editor =  document.getElementById('editor');
            editor.blur();
            let content = editor.innerHTML;
            let info = {
                command:'write',
                msg:content
            }
            latte.event(JSON.stringify(info));
            return "返回数据成功";
        }

        function queryBackData(){
            let editor =  document.getElementById('editor');
            editor.blur();
            let content = editor.innerHTML;
            let info = "";
            let empty = editor.innerText.length === 0;
            info = {
              command:'back',
              msg:content,
              isEmpty:empty
            }
            latte.event(JSON.stringify(info));
            return "返回数据成功";
        }
    </script>
</head>
<body>
    <div id="editor" style="border: none;outline: none;color: black">
    </div>
</body>
</html>